package com.example.services;

import com.example.models.User;
import com.example.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * Created by Lin on 2016/7/1.
 */
@Service    //用于标注业务层组件
public class UserService {
    @Autowired
    private UserRepository userRepository;

    @Cacheable(value = "login",keyGenerator = "wiselyKeyGenerator")
    public boolean login( User user){
        User one = userRepository.findOne(user.getName());
        if (user.getPwd().equals(one.getPwd())) {
            return true;
        }
        return false;

    }
}
